<div id="content">
	<%= render 'administrator/tabs' %>
</div>
<h2><%= t(:search)%> <%= t(:user)%></h2>
<div class="form-search">
	<%= render 'search' , {:locale=>params[:locale]} %>
</div>
<h2><%= t(:listing)%> <%= t(:user)%></h2>
<table class="scaffold-table">
	<tr>
		<th><%= t(:number)%></th>
		<th><%= t(:login_name)%></th>
		<th><%= t(:group)%></th>
		<th><%= t(:branch)%></th>
		<th><%= t(:login_count)%></th>
		<th><%= t(:login_fail_count)%></th>
		<th><%= t(:last_login_date_time)%></th>
		<th><%= t(:last_login_ip)%></th>
		<th><%= t(:language)%></th>
		<th><%= t(:view)%></th>
		<th><%= t(:edit)%></th>
		<th><%= t(:delete)%></th>
	</tr>
	<% @users.each_with_index do |user,index| %>
	<tr>
		<td><%= index+1 %></td>
		<td><%= user.login %></td>
		<td><%= user.group.name %></td>
		<td><%= user.branch.code+":"+user.branch.name %></td>
		<td><%= user.login_count %></td>
		<td><%= user.failed_login_count %></td>
		<td><%= user.current_login_at %></td>
		<td><%= user.current_login_ip %></td>
		<td><%= user.language %></td>
		<td class="command"> <% if can? :read, user %>
		<%= link_to image_tag("view-user-icon.png", :border => 0) , user  %>
		<% else %>
		-
		<% end %> </td>
		<td class="command"> <% if can? :update, user %>
		<%= link_to image_tag("edit-user-icon.png", :border => 0) , edit_user_path(user)  %>
		<% else %>
		-
		<% end %> </td>
		<td class="command"> <% if can? :destroy, user %>
		<%= link_to image_tag("delete-user-icon.png", :border => 0) , user , :confirm => 'Are you sure?', :method => :delete %>
		<% else %>
		-
		<% end %> </td>
	</tr>
	<% end %>
</table>
<%= will_paginate @users %>

<% if can? :create, User %>
<%= link_to image_tag("add-user-icon.png", :border => 0) , new_user_path , {:class => 'form-command'} %>
<%= link_to t(:new_user), new_user_path %>
<% end %> 